
 <!DOCTYPE HTML>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  
    <title>Spacemacs的安装与配置（基础篇） | RyanHuen</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no">
    
    <meta name="author" content="RyanHuen">
    

    
    <meta name="description" content="下载：
找到spacemacs的地址 ：

spacemacs的github地址：https://github.com/syl20bnr/spacemacs#documentation

建议使用master分之进行配置。

克隆spacemacs替代原有的.emacs.d目录





安装
直接使用emacs命令就可以打开spacemacs。

安装时会提问使用哪种编辑模式,补全模式等：">
<meta property="og:type" content="article">
<meta property="og:title" content="Spacemacs的安装与配置（基础篇）">
<meta property="og:url" content="http://www.ryanhuen.tech/2017/02/15/spacemacs_install_config/index.html">
<meta property="og:site_name" content="RyanHuen">
<meta property="og:description" content="下载：
找到spacemacs的地址 ：

spacemacs的github地址：https://github.com/syl20bnr/spacemacs#documentation

建议使用master分之进行配置。

克隆spacemacs替代原有的.emacs.d目录





安装
直接使用emacs命令就可以打开spacemacs。

安装时会提问使用哪种编辑模式,补全模式等：">
<meta property="og:updated_time" content="2017-02-15T12:07:27.631Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Spacemacs的安装与配置（基础篇）">
<meta name="twitter:description" content="下载：
找到spacemacs的地址 ：

spacemacs的github地址：https://github.com/syl20bnr/spacemacs#documentation

建议使用master分之进行配置。

克隆spacemacs替代原有的.emacs.d目录





安装
直接使用emacs命令就可以打开spacemacs。

安装时会提问使用哪种编辑模式,补全模式等：">

    
    <link rel="alternative" href="/atom.xml" title="RyanHuen" type="application/atom+xml">
    
    
    <link rel="icon" href="/img/favicon.ico">
    
    
    <link rel="apple-touch-icon" href="/img/jacman.jpg">
    <link rel="apple-touch-icon-precomposed" href="/img/jacman.jpg">
    
    <link rel="stylesheet" href="/css/style.css">
</head>

  <body>
    <header>
      
<div>
		
			<div id="imglogo">
				<a href="/"><img src="/img/logo.png" alt="RyanHuen" title="RyanHuen"/></a>
			</div>
			
			<div id="textlogo">
				<h1 class="site-name"><a href="/" title="RyanHuen">RyanHuen</a></h1>
				<h2 class="blog-motto">I hope I can protect the one thing I can&#39;t live without.</h2>
			</div>
			<div class="navbar"><a class="navbutton navmobile" href="#" title="菜单">
			</a></div>
			<nav class="animated">
				<ul>
					<ul>
					 
						<li><a href="/">首页</a></li>
					
						<li><a href="/archives">历程</a></li>
					
						<li><a href="/categories">分类</a></li>
					
						<li><a href="/tags">标签</a></li>
					
						<li><a href="/about">关于</a></li>
					
					<li>
 					
					<form class="search" action="//google.com/search" method="get" accept-charset="utf-8">
						<label>Search</label>
						<input type="search" id="search" name="q" autocomplete="off" maxlength="20" placeholder="搜索" />
						<input type="hidden" name="q" value="site:www.ryanhuen.tech">
					</form>
					
					</li>
				</ul>
			</nav>			
</div>
    </header>
    <div id="container">
      <div id="main" class="post" itemscope itemprop="blogPost">
  
	<article itemprop="articleBody"> 
		<header class="article-info clearfix">
  <h1 itemprop="name">
    
      <a href="/2017/02/15/spacemacs_install_config/" title="Spacemacs的安装与配置（基础篇）" itemprop="url">Spacemacs的安装与配置（基础篇）</a>
  </h1>
  <p class="article-author">By
       
		<a href="/about" title="RyanHuen" target="_blank" itemprop="author">RyanHuen</a>
		
  <p class="article-time">
    <time datetime="2017-02-15T09:40:37.000Z" itemprop="datePublished"> 发表于 2017-02-15</time>
    
  </p>
</header>
	<div class="article-content">
		
		<div id="toc" class="toc-article">
			<strong class="toc-title">文章目录</strong>
		
			<ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#下载："><span class="toc-number">1.</span> <span class="toc-text">下载：</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#安装"><span class="toc-number">2.</span> <span class="toc-text">安装</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#配置"><span class="toc-number">3.</span> <span class="toc-text">配置</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#启用关闭Layer"><span class="toc-number">3.1.</span> <span class="toc-text">启用关闭Layer</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#git管理spacemacs配置"><span class="toc-number">3.2.</span> <span class="toc-text">git管理spacemacs配置</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#优化evil配置："><span class="toc-number">3.3.</span> <span class="toc-text">优化evil配置：</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#配置customize-group功能修改的属性存放的位置"><span class="toc-number">3.4.</span> <span class="toc-text">配置customize-group功能修改的属性存放的位置</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#修改主题："><span class="toc-number">3.5.</span> <span class="toc-text">修改主题：</span></a></li></ol></li></ol>
		
		</div>
		
		<p><a id="orgfa88029"></a></p>
<h1 id="下载："><a href="#下载：" class="headerlink" title="下载："></a>下载：</h1><ol>
<li><p>找到spacemacs的地址 ：</p>
<ol>
<li><p>spacemacs的github地址：<a href="https://github.com/syl20bnr/spacemacs#documentation" target="_blank" rel="external">https://github.com/syl20bnr/spacemacs#documentation</a></p>
</li>
<li><p>建议使用master分之进行配置。</p>
</li>
<li><p>克隆spacemacs替代原有的.emacs.d目录</p>
</li>
</ol>
</li>
</ol>
<p><a id="org7521f0d"></a></p>
<h1 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h1><ol>
<li><p>直接使用emacs命令就可以打开spacemacs。</p>
</li>
<li><p>安装时会提问使用哪种编辑模式,补全模式等：</p>
<blockquote>
<p>我使用的是下表中的配置:</p>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">


<colgroup>
<col class="org-left">

<col class="org-left">
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">编辑模式</th>
<th scope="col" class="org-left">补全模式</th>
</tr>
</thead>

<tbody>
<tr>
<td class="org-left">vim</td>
<td class="org-left">auto-completion</td>
</tr>
</tbody>
</table>
</blockquote>
</li>
<li><p>打开emacs，开始安装配置spacemacs。</p>
<ol>
<li><p>由于spacemacs也是使用elpa源，因此如果使用国外官网，会比较慢，建议替换成使用国内的镜像源。</p>
<ol>
<li><p>在～目录下，找到.spacemacs文件，打开以后定位以下方法：</p>
<pre><code>user-init()
</code></pre></li>
<li><p>在这个方法的方法体内修改使用的源,代码如下</p>
<pre><code>(setq configuration-layer--elpa-archives
      &apos;((&quot;melpa-cn&quot; . &quot;http://elpa.emacs-china.org/melpa/&quot;)
        (&quot;org-cn&quot;   . &quot;http://elpa.emacs-china.org/org/&quot;)
        (&quot;gnu-cn&quot;   . &quot;http://elpa.emacs-china.org/gnu/&quot;)))
)
</code></pre></li>
<li><p>可以在前面“安装”步骤进行时，等到~/.spacemacs文件生成以后再对其修改，否则可能找不到这个文件,因为这个文件是在安装过程中生成的。</p>
</li>
</ol>
</li>
</ol>
</li>
<li><p>修改好安装源以后，重新打开spacemacs。安装完成以后会显示欢迎界面，就可以使用了</p>
</li>
<li><p>配置layer的启用</p>
</li>
</ol>
<p><a id="org95257ea"></a></p>
<h1 id="配置"><a href="#配置" class="headerlink" title="配置"></a>配置</h1><p><a id="org970c1b7"></a></p>
<h2 id="启用关闭Layer"><a href="#启用关闭Layer" class="headerlink" title="启用关闭Layer"></a>启用关闭Layer</h2><ol>
<li><p>找到以下代码位置</p>
<pre><code>dotspacemacs-configuration-layers
</code></pre></li>
<li><p>在这个方法的配置中，有一些默认自带的layer，我们只需要取消注释，进行安装就可以启用了。可以启用的如下：</p>
<blockquote>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">


<colgroup>
<col class="org-left">

<col class="org-left">
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">layer名称</th>
<th scope="col" class="org-left">描述信息</th>
</tr>
</thead>

<tbody>
<tr>
<td class="org-left">ivy</td>
<td class="org-left">swiper搜索插件</td>
</tr>


<tr>
<td class="org-left">auto-completion</td>
<td class="org-left">自动补全</td>
</tr>


<tr>
<td class="org-left">better-defaults</td>
<td class="org-left">更好的使用spacemacs，如增加C-a,C-e为跳转到非空行首行尾</td>
</tr>


<tr>
<td class="org-left">emacs-lisp</td>
<td class="org-left">官方默认启用</td>
</tr>


<tr>
<td class="org-left">markdown</td>
<td class="org-left">markdown的layer</td>
</tr>


<tr>
<td class="org-left">org</td>
<td class="org-left">org-mode的layer</td>
</tr>


<tr>
<td class="org-left">spell-checking</td>
<td class="org-left">拼写检查</td>
</tr>


<tr>
<td class="org-left">syntax-checking</td>
<td class="org-left">语法检查</td>
</tr>
</tbody>
</table>
</blockquote>
</li>
<li><p>启用以后，可以执行以下命令刷新package，而不需要重启emacs（当然重启也是没有问题的）</p>
<blockquote>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">


<colgroup>
<col class="org-left">

<col class="org-left">
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">快捷键</th>
<th scope="col" class="org-left">作用</th>
</tr>
</thead>

<tbody>
<tr>
<td class="org-left">SPC-f-e-R</td>
<td class="org-left">刷新layer，没有安装的会自动进行安装</td>
</tr>
</tbody>
</table>


</blockquote>
</li>
</ol>
<p><a id="org29db8c8"></a></p>
<h2 id="git管理spacemacs配置"><a href="#git管理spacemacs配置" class="headerlink" title="git管理spacemacs配置"></a>git管理spacemacs配置</h2><ol>
<li><p>将自己的spacemacs配置添加到git仓库进行管理</p>
<ol>
<li><p>新建目录：</p>
<pre><code>~/.spacemacs.d
</code></pre></li>
<li><p>复制.spacemacs文件到上述目录中，修改名称为init.el</p>
</li>
</ol>
</li>
</ol>
<p><a id="orge4641cd"></a></p>
<h2 id="优化evil配置："><a href="#优化evil配置：" class="headerlink" title="优化evil配置："></a>优化evil配置：</h2><ol>
<li><p>找到以下代码位置：</p>
<pre><code>(defun dotspacemacs/user-config ()
</code></pre></li>
<li><p>添加以下代码到上述方法中：</p>
<pre><code>(setcdr evil-insert-state-map nil)
(define-key evil-insert-state-map [escape] &apos;evil-normal-state)
</code></pre></li>
</ol>
<p><a id="org9b607d3"></a></p>
<h2 id="配置customize-group功能修改的属性存放的位置"><a href="#配置customize-group功能修改的属性存放的位置" class="headerlink" title="配置customize-group功能修改的属性存放的位置"></a>配置customize-group功能修改的属性存放的位置</h2><ol>
<li><p>通常我们希望将customize-group功能修改的这些属性存放到custom.el中，方便我们随时查看，管理。</p>
</li>
<li><p>因此，在.spacemacs.d/.init.el结尾处加入以下代码：</p>
<pre><code>(setq custom-file (expand-file-name &quot;custom.el&quot; dotspacemacs-directory))
(load custom-file &apos;no-error &apos;no-message)
</code></pre></li>
</ol>
<p><a id="org4985763"></a></p>
<h2 id="修改主题："><a href="#修改主题：" class="headerlink" title="修改主题："></a>修改主题：</h2><ol>
<li><p>找到以下代码位置：</p>
<pre><code>dotspacemacs-themes &apos;(
</code></pre></li>
<li><p>需要什么主题，在其中加入即可，第一行的主题会优先被加载。如下：</p>
<pre><code>dotspacemacs-themes &apos;(solarized-dark
                      monokai
                      spacemacs-dark
                      spacemacs-light
                      solarized-light
                      leuven
                      zenburn)
</code></pre></li>
</ol>
  
	</div>
		<footer class="article-footer clearfix">
<div class="article-catetags">

<div class="article-categories">
  <span></span>
  <a class="article-category-link" href="/categories/Emacs系列/">Emacs系列</a>
</div>


  <div class="article-tags">
  
  <span></span> <a href="/tags/Spacemacs/">Spacemacs</a><a href="/tags/Emacs/">Emacs</a>
  </div>

</div>



	<div class="article-share" id="share">
	
	  <div data-url="http://www.ryanhuen.tech/2017/02/15/spacemacs_install_config/" data-title="Spacemacs的安装与配置（基础篇） | RyanHuen" data-tsina="null" class="share clearfix">
	  </div>
	
	</div>


</footer>

   	       
	</article>
	
<nav class="article-nav clearfix">
 
 <div class="prev" >
 <a href="/2017/02/15/rx-serials-respon-explain/" title="什么是响应式编程">
  <strong>上一篇：</strong><br/>
  <span>
  什么是响应式编程</span>
</a>
</div>


<div class="next">
<a href="/2017/02/15/org-mode-grammar/"  title="Org-mode语法基础">
 <strong>下一篇：</strong><br/> 
 <span>Org-mode语法基础
</span>
</a>
</div>

</nav>

	
<section id="comments" class="comment">
	<div class="ds-thread" data-thread-key="2017/02/15/spacemacs_install_config/" data-title="Spacemacs的安装与配置（基础篇）" data-url="http://www.ryanhuen.tech/2017/02/15/spacemacs_install_config/"></div>
</section>


</div>  
      <div class="openaside"><a class="navbutton" href="#" title="显示侧边栏"></a></div>

  <div id="toc" class="toc-aside">
  <strong class="toc-title">文章目录</strong>
 
 <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#下载："><span class="toc-number">1.</span> <span class="toc-text">下载：</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#安装"><span class="toc-number">2.</span> <span class="toc-text">安装</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#配置"><span class="toc-number">3.</span> <span class="toc-text">配置</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#启用关闭Layer"><span class="toc-number">3.1.</span> <span class="toc-text">启用关闭Layer</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#git管理spacemacs配置"><span class="toc-number">3.2.</span> <span class="toc-text">git管理spacemacs配置</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#优化evil配置："><span class="toc-number">3.3.</span> <span class="toc-text">优化evil配置：</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#配置customize-group功能修改的属性存放的位置"><span class="toc-number">3.4.</span> <span class="toc-text">配置customize-group功能修改的属性存放的位置</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#修改主题："><span class="toc-number">3.5.</span> <span class="toc-text">修改主题：</span></a></li></ol></li></ol>
 
  </div>

<div id="asidepart">
<div class="closeaside"><a class="closebutton" href="#" title="隐藏侧边栏"></a></div>
<aside class="clearfix">

  
<div class="categorieslist">
	<p class="asidetitle">分类</p>
		<ul>
		
		  
			<li><a href="/categories/Emacs系列/" title="Emacs系列">Emacs系列<sup>3</sup></a></li>
		  
		
		  
			<li><a href="/categories/Framework系列/" title="Framework系列">Framework系列<sup>1</sup></a></li>
		  
		
		  
			<li><a href="/categories/RXJava系列/" title="RXJava系列">RXJava系列<sup>7</sup></a></li>
		  
		
		  
			<li><a href="/categories/git入门系列/" title="git入门系列">git入门系列<sup>5</sup></a></li>
		  
		
		  
			<li><a href="/categories/Emacs系列/org-mode/" title="org-mode">org-mode<sup>1</sup></a></li>
		  
		
		</ul>
</div>


  
<div class="tagslist">
	<p class="asidetitle">标签</p>
		<ul class="clearfix">
		
			
				<li><a href="/tags/RxJava/" title="RxJava">RxJava<sup>7</sup></a></li>
			
		
			
				<li><a href="/tags/git/" title="git">git<sup>5</sup></a></li>
			
		
			
				<li><a href="/tags/RxJava基础/" title="RxJava基础">RxJava基础<sup>4</sup></a></li>
			
		
			
				<li><a href="/tags/Spacemacs/" title="Spacemacs">Spacemacs<sup>3</sup></a></li>
			
		
			
				<li><a href="/tags/Emacs/" title="Emacs">Emacs<sup>3</sup></a></li>
			
		
			
				<li><a href="/tags/观察者模式/" title="观察者模式">观察者模式<sup>3</sup></a></li>
			
		
			
				<li><a href="/tags/BackPressure/" title="BackPressure">BackPressure<sup>1</sup></a></li>
			
		
			
				<li><a href="/tags/org/" title="org">org<sup>1</sup></a></li>
			
		
			
				<li><a href="/tags/Java回调/" title="Java回调">Java回调<sup>1</sup></a></li>
			
		
			
				<li><a href="/tags/Debug/" title="Debug">Debug<sup>1</sup></a></li>
			
		
			
				<li><a href="/tags/设计模式/" title="设计模式">设计模式<sup>1</sup></a></li>
			
		
			
				<li><a href="/tags/RxJava操作符/" title="RxJava操作符">RxJava操作符<sup>1</sup></a></li>
			
		
			
				<li><a href="/tags/响应式编程/" title="响应式编程">响应式编程<sup>1</sup></a></li>
			
		
			
				<li><a href="/tags/Android-Studio/" title="Android Studio">Android Studio<sup>1</sup></a></li>
			
		
			
				<li><a href="/tags/Framework/" title="Framework">Framework<sup>1</sup></a></li>
			
		
			
				<li><a href="/tags/org-mode/" title="org-mode">org-mode<sup>1</sup></a></li>
			
		
		</ul>
</div>


  <div class="rsspart">
	<a href="/atom.xml" target="_blank" title="rss">RSS 订阅</a>
</div>

</aside>
</div>
    </div>
    <footer><div id="footer" >
	
	<div class="line">
		<span></span>
		<div class="author"></div>
	</div>
	
	
	<section class="info">
		<p> Hi there,I&#39;m RyanHuen <br/>
			A simple programmer</p>
	</section>
	 
	<div class="social-font" class="clearfix">
		
		<a href="http://weibo.com/ryanxuan" target="_blank" class="icon-weibo" title="微博"></a>
		
		
		<a href="https://github.com/RyanHuen" target="_blank" class="icon-github" title="github"></a>
		
		
		
		
		
		
		
		<a href="http://www.zhihu.com/people/ryan-hyn" target="_blank" class="icon-zhihu" title="知乎"></a>
		
		
		
		<a href="mailto:ryanhuenwork@163.com" target="_blank" class="icon-email" title="Email Me"></a>
		
	</div>
			
		

		<p class="copyright">
		Powered by <a href="http://hexo.io" target="_blank" title="hexo">hexo</a> and Theme by <a href="https://github.com/wuchong/jacman" target="_blank" title="Jacman">Jacman</a> © 2017 
		
		<a href="/about" target="_blank" title="RyanHuen">RyanHuen</a>
		
		
		</p>
</div>
</footer>
    <script src="/js/jquery-2.0.3.min.js"></script>
<script src="/js/jquery.imagesloaded.min.js"></script>
<script src="/js/gallery.js"></script>
<script src="/js/jquery.qrcode-0.12.0.min.js"></script>

<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>
<script type="text/javascript">
$(document).ready(function(){ 
  $('.navbar').click(function(){
    $('header nav').toggleClass('shownav');
  });
  var myWidth = 0;
  function getSize(){
    if( typeof( window.innerWidth ) == 'number' ) {
      myWidth = window.innerWidth;
    } else if( document.documentElement && document.documentElement.clientWidth) {
      myWidth = document.documentElement.clientWidth;
    };
  };
  var m = $('#main'),
      a = $('#asidepart'),
      c = $('.closeaside'),
      o = $('.openaside');
  c.click(function(){
    a.addClass('fadeOut').css('display', 'none');
    o.css('display', 'block').addClass('fadeIn');
    m.addClass('moveMain');
  });
  o.click(function(){
    o.css('display', 'none').removeClass('beforeFadeIn');
    a.css('display', 'block').removeClass('fadeOut').addClass('fadeIn');      
    m.removeClass('moveMain');
  });
  $(window).scroll(function(){
    o.css("top",Math.max(80,260-$(this).scrollTop()));
  });
  
  $(window).resize(function(){
    getSize(); 
    if (myWidth >= 1024) {
      $('header nav').removeClass('shownav');
    }else{
      m.removeClass('moveMain');
      a.css('display', 'block').removeClass('fadeOut');
      o.css('display', 'none');
      
      $('#toc.toc-aside').css('display', 'none');
        
    }
  });
});
</script>

<script type="text/javascript">
$(document).ready(function(){ 
  var ai = $('.article-content>iframe'),
      ae = $('.article-content>embed'),
      t  = $('#toc'),
      ta = $('#toc.toc-aside'),
      o  = $('.openaside'),
      c  = $('.closeaside');
  if(ai.length>0){
    ai.wrap('<div class="video-container" />');
  };
  if(ae.length>0){
   ae.wrap('<div class="video-container" />');
  };
  c.click(function(){
    ta.css('display', 'block').addClass('fadeIn');
  });
  o.click(function(){
    ta.css('display', 'none');
  });
  $(window).scroll(function(){
    ta.css("top",Math.max(140,320-$(this).scrollTop()));
  });
});
</script>


<script type="text/javascript">
$(document).ready(function(){ 
  var $this = $('.share'),
      url = $this.attr('data-url'),
      encodedUrl = encodeURIComponent(url),
      title = $this.attr('data-title'),
      tsina = $this.attr('data-tsina'),
      description = $this.attr('description');
  var html = [
  '<div class="hoverqrcode clearfix"></div>',
  '<a class="overlay" id="qrcode"></a>',
  '<a href="https://www.facebook.com/sharer.php?u=' + encodedUrl + '" class="article-share-facebook" target="_blank" title="Facebook"></a>',
  '<a href="https://twitter.com/intent/tweet?url=' + encodedUrl + '" class="article-share-twitter" target="_blank" title="Twitter"></a>',
  '<a href="#qrcode" class="article-share-qrcode" title="微信"></a>',
  '<a href="http://widget.renren.com/dialog/share?resourceUrl=' + encodedUrl + '&srcUrl=' + encodedUrl + '&title=' + title +'" class="article-share-renren" target="_blank" title="人人"></a>',
  '<a href="http://service.weibo.com/share/share.php?title='+title+'&url='+encodedUrl +'&ralateUid='+ tsina +'&searchPic=true&style=number' +'" class="article-share-weibo" target="_blank" title="微博"></a>',
  '<span title="Share to"></span>'
  ].join('');
  $this.append(html);

  $('.hoverqrcode').hide();

  var myWidth = 0;
  function updatehoverqrcode(){
    if( typeof( window.innerWidth ) == 'number' ) {
      myWidth = window.innerWidth;
    } else if( document.documentElement && document.documentElement.clientWidth) {
      myWidth = document.documentElement.clientWidth;
    };
    var qrsize = myWidth > 1024 ? 200:100;
    var options = {render: 'image', size: qrsize, fill: '#2ca6cb', text: url, radius: 0.5, quiet: 1};
    var p = $('.article-share-qrcode').position();
    $('.hoverqrcode').empty().css('width', qrsize).css('height', qrsize)
                          .css('left', p.left-qrsize/2+20).css('top', p.top-qrsize-10)
                          .qrcode(options);
  };
  $(window).resize(function(){
    $('.hoverqrcode').hide();
  });
  $('.article-share-qrcode').click(function(){
    updatehoverqrcode();
    $('.hoverqrcode').toggle();
  });
  $('.article-share-qrcode').hover(function(){}, function(){
      $('.hoverqrcode').hide();
  });
});   
</script>



<script type="text/javascript">
  var duoshuoQuery = {short_name:"ryanhuen"};
  (function() {
    var ds = document.createElement('script');
    ds.type = 'text/javascript';ds.async = true;
    ds.src = '//static.duoshuo.com/embed.js';
    ds.charset = 'UTF-8';
    (document.getElementsByTagName('head')[0] 
    || document.getElementsByTagName('body')[0]).appendChild(ds);
  })();
</script> 







<link rel="stylesheet" href="/fancybox/jquery.fancybox.css" media="screen" type="text/css">
<script src="/fancybox/jquery.fancybox.pack.js"></script>
<script type="text/javascript">
$(document).ready(function(){ 
  $('.article-content').each(function(i){
    $(this).find('img').each(function(){
      if ($(this).parent().hasClass('fancybox')) return;
      var alt = this.alt;
      if (alt) $(this).after('<span class="caption">' + alt + '</span>');
      $(this).wrap('<a href="' + this.src + '" title="' + alt + '" class="fancybox"></a>');
    });
    $(this).find('.fancybox').each(function(){
      $(this).attr('rel', 'article' + i);
    });
  });
  if($.fancybox){
    $('.fancybox').fancybox();
  }
}); 
</script>



<!-- Analytics Begin -->



<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "//hm.baidu.com/hm.js?af124d045b4aed59105f75db52359992";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>



<!-- Analytics End -->

<!-- Totop Begin -->

	<div id="totop">
	<a title="返回顶部"><img src="/img/scrollup.png"/></a>
	</div>
	<script src="/js/totop.js"></script>

<!-- Totop End -->

<!-- MathJax Begin -->
<!-- mathjax config similar to math.stackexchange -->


<!-- MathJax End -->

<!-- Tiny_search Begin -->

<!-- Tiny_search End -->

  </body>
</html>
